home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / c / hce.lha / HCE / LibSource / clib / Misc / src / WbParse.c < prev   
Encoding:
C/C++ Source or Header  |  1992-09-02  |  1.4 KB  |  60 lines

  1. /*
  2.  * This module invoked if called from workbench.
  3.  */
  4.  
  5. #include <libraries/dosextens.h>
  6. #include <workbench/workbench.h>
  7. #include <workbench/startup.h>
  8. #include <workbench/icon.h>
  9.  
  10. typedef struct DiskObject DISKOBJ;
  11. typedef struct Process PROC;
  12. typedef struct FileHandle HANDLE;
  13. typedef struct WBStartup WBSTART;
  14. typedef struct WBArg WBARG;
  15.  
  16. void *IconBase = 0;
  17. extern void CloseLibrary(), FreeDiskObject();
  18. extern void *OpenLibrary();
  19. extern long Open();
  20. extern DISKOBJ *GetDiskObject();
  21. extern char *FindToolType();
  22.  
  23. _wb_parse(processp, wbMsg)
  24. register PROC *processp;
  25. WBSTART *wbMsg;
  26. {
  27.     register char *cp;
  28.     register DISKOBJ *diskobjp;
  29.     register HANDLE    *handlep;
  30.     register ULONG window;
  31.     WBARG *wbMsgp;
  32.  
  33.     if ( !(IconBase = OpenLibrary("icon.library", 0L)) )
  34.         return;
  35.     wbMsgp = wbMsg->sm_ArgList;
  36.     if ( !(diskobjp = GetDiskObject(wbMsgp->wa_Name)) )
  37.         goto done;
  38.  
  39.     /*
  40.      * Manx does this, and it seems like a good idea.
  41.      */
  42.  
  43.     cp = FindToolType(diskobjp->do_ToolTypes, "WINDOW");
  44.  
  45.           if(cp[0] != '\0')          /* Changed by J.P. */
  46.               {
  47.         if (window = Open(cp, MODE_OLDFILE))
  48.                     {
  49.             handlep =  (HANDLE *)(window << 2);
  50.             processp->pr_ConsoleTask = (void *)handlep->fh_Type;
  51.             processp->pr_CIS = window;
  52.             processp->pr_COS = Open("*", MODE_OLDFILE);
  53.              }
  54.            }
  55.     FreeDiskObject(diskobjp);
  56. done:
  57.     CloseLibrary(IconBase);
  58.     IconBase = 0L;
  59. }
  60.